package com.doudou.collection.adapter.controller.admin.system;

import com.doudou.collection.domain.service.admin.SysRoleService;
import com.doudou.collection.infrastructure.common.pojo.vo.PageData;
import com.doudou.collection.infrastructure.common.web.ResultVO;
import com.doudou.collection.orm.dto.admin.role.RoleQueryDTO;
import com.doudou.collection.orm.vo.admin.SysRoleVO;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName SysRoleController
 * @Description 角色管理
 * @Author blue sky
 * @Date 2023/7/2 11:49
 * @Version 1.0
 */
@Slf4j
@RestController
@Api(tags = "13.角色管理模块")
@RequestMapping("/prod-api/system/role")
public class SysRoleController {

    @Autowired
    private SysRoleService sysRoleService;


    @GetMapping("/list")
    @ApiOperation("获取角色列表")
    @ApiOperationSupport(order = 410)
    @PreAuthorize("hasAnyAuthority('system:role:list')")
    public ResultVO list(RoleQueryDTO roleQueryDTO) {
        log.debug("正在处理【获取所有角色】的请求，参数：{}", roleQueryDTO);
        PageData<SysRoleVO> pageData = sysRoleService.list(roleQueryDTO);
        return ResultVO.ok(pageData);
    }
}
